Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 4 - Colors and Color-Related Objects / Using Colors and Color-Related Objects


Manipulating Object Properties of Color Sets and Color Profiles

This section describes how to manipulate the common object properties of color sets and color profiles: owner count and tag list. It also describes how to manipulate the colors of a color set and the profile data of a color profile.

For manipulating color sets and color profiles as whole objects, see "Creating and Manipulating Color Set and Color Profile Objects" beginning on page 4-42.

Manipulating Owner Counts

The owner count of an object indicates the number of current references to that object. In general, QuickDraw GX manages owner counts for you. For example, when you create a new color set object, QuickDraw GX sets the owner count of the new color set to 1. If you assign that color profile object to a bitmap structure and then assign that bitmap structure to a bitmap shape, QuickDraw GX increments the color profile's owner count, corresponding to the new reference to the color profile contained in the bitmap structure.

In some situations, as when switching color profiles or color sets among objects that reference them, you may want to directly manage their owner counts yourself. To do so, you can

The code fragment on page 4-45 shows an example of an application explicitly managing the owner count of a color profile object.

The GXGetColorSetOwners function is described on page 4-69. The GXGetColorProfileOwners function is described on page 4-84.

In the chapter "Style Objects" in this book, the section on manipulating a style object's owner count discusses two common owner-count problems and how to avoid them. The problems are discussed in terms of style objects, but they apply equally well to color sets and color profiles. Refer to that discussion if you find that the color-related objects you create have owner counts that are higher or lower than you expect.

Getting and Setting Tag References

You can examine the list of references to tag objects currently associated with a
color set object or color profile object by using the GXGetColorSetTags or GXGetColorProfileTags function. Once you create a tag object, you can attach
it to its object using the GXSetColorSetTags or GXSetColorProfileTags function. You can attach as many tag objects as you like to a color set or color profile.

Tag objects and the basic functions for manipulating them are described in the chapter "Tag Objects" in this book. That chapter also lists the common tag types defined and reserved by Apple Computer, Inc.

The GXGetColorSetTags function is described on page 4-70; the GXGetColorProfileTags function is described on page 4-85.
The GXSetColorSetTags function is described on page 4-71; the GXSetColorProfileTags function is described on page 4-86.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996